package top.drinyeit.weilong.base;

import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import top.drinyeit.weilong.R;
import top.drinyeit.weilong.dialog.LoadDialog;
import top.drinyeit.weilong.util.ToastUtil;

/**
 * Created by Administrator on 2017/11/10.
 */

public class BaseFragment extends Fragment implements IBaseView{
    private LoadDialog loadDialog;

    public void init(){

    }

    //首页搜索

    public void setBigSearch(View view){
        RelativeLayout big_search;

        big_search = view.findViewById(R.id.big_search);

        big_search.setVisibility(View.VISIBLE);
    }
    //白底绿返回
    public void setToolbar2 (View view,  final String tool){
        //common_toolbar2
        RelativeLayout common_toolbar2;
        TextView toolbar2;//标题

        common_toolbar2 = view.findViewById(R.id.common_toolbar2);
        toolbar2 = view.findViewById(R.id.toolbar2);

        common_toolbar2.setVisibility(View.VISIBLE);

        toolbar2.setText(tool);

    }

    public void inmV(){

    }

    protected void showToast(String msg){
        ToastUtil.getInstance(getContext()).showToastCenter(msg);
    }

    @Override
    public void showToastMsg(String msg) {
        Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void showLoading() {
        if (loadDialog == null) {
            loadDialog = new LoadDialog(getContext());
        }
        loadDialog.show();
    }

    @Override
    public void dismissLoading() {
        if (loadDialog != null) {
            loadDialog.hide();
        }
    }
}
